package com.geostart.constructionland.system.controller;

import com.geostar.constructionland.common.entity.response.ExtJsAjaxResponse;
import com.geostart.constructionland.system.service.AnalyseFxrzFeignClient;
import com.geostart.constructionland.system.service.AnalyseMappedFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.constraints.NotBlank;

/**
 * @author chengan
 * @description
 */
@Api
@Controller
@RequestMapping(path = "/analyseFxrz")
public class AnalyseFxrzController {

    @Autowired
    AnalyseFxrzFeignClient analyseFxrzFeignClient;

    @RequestMapping(path = "/profile")
    public String initPage() {
        return "profile/analyseFxrz_profile";
    }

    @PostMapping("/getAnalyseFxrz")
    @ResponseBody
    @ApiOperation(value = "获取分析日志")
    public ExtJsAjaxResponse getAnalyseFxrz(@NotBlank(message = "页码不能为空")  @RequestParam(value = "page") int pageNo,
                                              @NotBlank(message = "每页数量不能为空") @RequestParam(value = "limit") int pageNum
                                              ,@RequestParam(required=false) String query_xmmc){
        return analyseFxrzFeignClient.getAnalyseFxrz(pageNo,pageNum,query_xmmc);
    }

    @PostMapping("/getAnalyseStastics")
    @ResponseBody
    @ApiOperation(value = "获取分析日志统计信息")
    public  ExtJsAjaxResponse getAnalyseFxrzStatistic(@NotBlank(message = "页码不能为空")  @RequestParam(value = "page") int pageNo,
                                                      @NotBlank(message = "每页数量不能为空") @RequestParam(value = "limit") int pageNum
            ,@RequestParam(required=false) String query_ywid){
        return analyseFxrzFeignClient.getFxrzStatisstics(pageNo,pageNum,query_ywid);
    }

    @PostMapping("/getAnalyseFxrzByYwid")
    @ResponseBody
    @ApiOperation(value = "通过ywid获取分析日志")
    public ExtJsAjaxResponse getAnalyseFxrzByYwid(@RequestParam(required=false) String ywid){
        return analyseFxrzFeignClient.getAnalyseFxrzByYwid(ywid);
    }


    @PostMapping("/getAnalyseFxrzLsByYwid")
    @ResponseBody
    @ApiOperation(value = "通过ywid获取分析日志历史信息")
    public ExtJsAjaxResponse getAnalyseFxrzLsByYwid(@RequestParam(required=false) String ywid){
        return analyseFxrzFeignClient.getAnalyseFxrzLsByYwid(ywid);
    }


}
